        var url2 = 'necesare/captcha/ret_ahah.php?cod=';
        var captchaOK = 2;  // 2 - not yet checked, 1 - correct, 0 - failed
        
        function getHTTPObject()
        {
        try {
        req = new XMLHttpRequest();
          } catch (err1)
          {
          try {
          req = new ActiveXObject("Msxml2.XMLHTTP");
          } catch (err2)
          {
          try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (err3)
            {
	req = false;
            }
          }
		}
	        return req;
		}
        
        var http = getHTTPObject(); // We create the HTTP Object        
        
        function handleHttpResponse() {
        if (http.readyState == 4) {
            captchaOK = http.responseText;
            if (captchaOK != 1) {
              alert('Codul introdus nu este corect. Incercati din nou.');
              document.com.cod.value='';
              document.com.cod.focus();
              return false;
              }
              document.com.submit();
           }
        }	
		
		
        function checkcode(thecode) {
        http.open("GET", url2 + escape(thecode), true);
        http.onreadystatechange = handleHttpResponse;
        http.send(null);
        }		
				
		function gol(ob)
		{
        if(ob.value=='') 
		  {
          alert('Completeaza campul '+ob.name);
          ob.focus();
          return true;
          }
		return false;	
		}
		
        function checkform() 
		{
		if ( gol(document.com.name) || gol(document.com.comentariu) || gol(document.com.cod) )
		 return false;		
        checkcode(document.com.cod.value);
        return false;
        } 